<?php

class DBU_Logger {

    protected $_sessionName = 'db_logger';

    public function  __construct() {
        $this->add('Start Page');
    }

    public function add($message) {
        $_SESSION[$this->_sessionName][] = array(
            'message' => $message,
            'time' => time()
            );
    }

    public function getAll() {
        return $_SESSION[$this->_sessionName];
    }

    public function reset() {
        $_SESSION[$this->_sessionName] = array();
    }

    /**
     * Singleton
     *
     * @return DBU_Logger
     */
	public static function instance() {
		static $instance;
		if (!($instance instanceof self)) {
			$instance = new self();
		}
		return $instance;
	}
}